package org.example;

import org.example.operator.Operator;
import org.example.operator.OperatorFactory;

import java.math.BigDecimal;


public class Calculate {

    public static final OperatorFactory OPERATOR_FACTORY = new OperatorFactory();

    public static String calculate(BigDecimal num1, BigDecimal num2, char sign){
        Operator operator = OPERATOR_FACTORY.getOperator(sign);
        return operator.operate(num1,num2);
    }

    public static String calculate(Expression expression){
        Operator operator = OPERATOR_FACTORY.getOperator(expression.getSign());
        return operator.operate(expression.getNum1(),expression.getNum2());
    }
}
